package cn.csg.iotplatform.module.system.enums;

import cn.csg.iotplatform.module.system.controller.admin.dept.vo.dept.DeptTreeSearchVO;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 机构树类型
 */
@Getter
@AllArgsConstructor
public enum DeptTreeTypeEnum {

    FOUR4,
    SYSTEM,
    PROJECT,
    USER
    ;

    public static DeptTreeTypeEnum valueOf(DeptTreeSearchVO searchVO) {
        if(searchVO.getProjectAttr() != null && searchVO.getProjectAttr() == 1) return DeptTreeTypeEnum.PROJECT;
        if(searchVO.getUserAttr() != null && searchVO.getUserAttr() == 1) return DeptTreeTypeEnum.USER;
        if(searchVO.getUseFlag() != null && searchVO.getUseFlag()) return DeptTreeTypeEnum.SYSTEM;
        return DeptTreeTypeEnum.FOUR4;
    }
}
